package com.zy.xuanwo.application;

import android.app.Application;
import android.content.Context;

import com.zhy.http.okhttp.OkHttpUtils;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Created by Administrator on 2016/7/6 0006.
 */
public class MyApplication extends Application {


    //全局Context
    private static Context sContext;



    @Override
    public void onCreate() {
        super.onCreate();

        sContext = getApplicationContext();

        //配置OkHttp
        configOkHttp();


    }

    private void configOkHttp() {

        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();

        OkHttpUtils.initClient(okHttpClient);
    }



    public static Context getContext() {
        return sContext;
    }



}
